APPICONDIR = appicons
SRCDIR = src

PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
APPDIR = $(PREFIX)/share/applications

all:
	@echo "Building emu"
	cd $(SRCDIR) && qmake && make
	@echo "Done. Execute 'make install' as root to install emu."

clean:
	cd $(SRCDIR) && qmake && make clean

dist: all
	tar -c --exclude=*.svn --exclude=moc* --exclude=*.o --gzip * > emuclient-1.0.0.tar.gz

install:
	install -m 755 $(SRCDIR)/emuclient $(DESTDIR)/$(BINDIR)/emuclient
	install -m 644 emuclient.desktop $(APPDIR)/emuclient.desktop
	xdg-icon-resource install --size 16 appicons/emuclient-16.png
	xdg-icon-resource install --size 22 appicons/emuclient-22.png
	xdg-icon-resource install --size 32 appicons/emuclient-32.png
	xdg-icon-resource install --size 64 appicons/emuclient-64.png

uninstall:
	rm $(BINDIR)/emuclient
	rm $(APPDIR)/emuclient.desktop
	rm -r ~/.config/emu
	xdg-icon-resource uninstall --size 16 appicons/emuclient-16.png
	xdg-icon-resource uninstall --size 22 appicons/emuclient-22.png
	xdg-icon-resource uninstall --size 32 appicons/emuclient-32.png
	xdg-icon-resource uninstall --size 64 appicons/emuclient-64.png

.PHONY: all clean dist install uninstall
